﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using reminder_csh.Entities;

namespace reminder_csh {
    public partial class Form2 : Form {

        private WorkerManagerImpl Wmanager;

        public Form2() {
            InitializeComponent();
            Wmanager=new WorkerManagerImpl();
        }

        private void Form2_Load(object sender, EventArgs e) {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            var email = emailTextBox.Text;
            var name = nameTextBox.Text;
            //if()

            Wmanager.CreatePerson(new Worker {
                Email=email,
                Name=name,
                PicturePath=picturePathLabel2.Text
            });
            Wmanager.Dispose();

        }

        private void button3_Click(object sender, EventArgs e) {
            var open=new OpenFileDialog();

            open.Filter="Text Files (.jpeg)|*.jpg|All Files (*.*)|*.*";
            open.FilterIndex=1;
            open.ShowDialog();
            picturePathLabel2.Text=string.Format(open.FileName);
        }

        /* protected override void OnDeactivate(EventArgs e) {
             manager.Dispose();
             base.OnDeactivate(e);
         }

         protected override void OnClosed(EventArgs e) {
             base.OnClosed(e);
             manager.Dispose();
         }

         protected override void OnClosing(CancelEventArgs e) {
             base.OnClosing(e);
             manager.Dispose();
         }

         protected override void OnFormClosing(FormClosingEventArgs e) {
             base.OnFormClosing(e);
             manager.Dispose();
         }*/
    }
}
